package org.codeblue.support.time;

import java.text.DateFormat;
import java.text.ParsePosition;
import java.util.Date;

public class DateFormatUtil {
    /**
     * @see DateFormat#parse(String)
     */
    public static Date parse(DateFormat dateFormat, String source) {
        ParsePosition pos = new ParsePosition(0);
        Date result = dateFormat.parse(source, pos);
        if (pos.getIndex() == 0) {
            throw new RuntimeException("parse data Error");
        }
        return result;
    }
}